import React, { useRouteError } from 'react-router-dom';

function RootErrorBoundary() {
    const error = useRouteError() as Error;
    return (
        <div>
            <h1>哦，出了严重的问题 😩</h1>
            <pre>{error.message || JSON.stringify(error)}</pre>
            <button
                type='button'
                onClick={() => {
                    window.location.href = '/';
                }}
            >
                单击此处重新加载应用程序
            </button>
        </div>
    );
}

export default RootErrorBoundary;
